<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>供品管理</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <style>
        body {
            font-size: 14px;
        }

        footer.aui-nav {
            z-index: 99999;
        }

        header.aui-bar {
            background: #fff;
        }

        .aui-title {
            color: #000;
        }

        .aui-nav .aui-bar-tab .active .aui-iconfont, .aui-nav .aui-bar-tab .active p {
            color: #327afa !important;
        }

        .active {
            color: #327afa !important;
        }

        .aui-tab-nav li.active {
            color: #327afa;
            border-bottom: 2px #327afa solid;
        }

        .aui-bar .aui-iconfont {
            color: #000;
        }

        .walletInfo {
            position: relative;
            width: 100%;
            overflow: hidden;
            background: #f67b86;
            text-align: left;
            padding: 0 0 15px 15px;
        }

        .walletInfo p {
            font-size: 28px;
            color: #fff;
            line-height: 28px;
        }

        .tixianBtn {
            color: #fff;
            border: 1px solid #fff;
            display: inline-block;
            padding: 12px 22px;
            position: absolute;
            right: 15px;
            top: 25px;
            line-height: 12px;
            border-radius: 5px;
        }

        .wallet_set {
            /*position: absolute;*/
            color: #000;
        }
    </style>
</head>
<body>
<header class="aui-bar aui-bar-nav aui-border-b">
    <div class="aui-pull-left aui-iconfont aui-icon-left icon-left-coler" tapmode onclick="closeWin()"></div>
    <div class="aui-title">
        供品管理
    </div>
    <ul class="aui-tab-nav aui-border-t haderTitle">
        <li class="active" data-type="1" data-id="3" tapmode onclick="changeCheck(this)">
            销售中(<span id="salesIn">0</span>)
        </li>
        <li data-type="2" data-id="4" tapmode onclick="changeCheck(this)">
            待上架(<span id="shelfOff">0</span>)
        </li>
        <li data-type="3" data-id="2" tapmode onclick="changeCheck(this)">
            待审核(<span id="auditWait">0</span>)
        </li>
    </ul>
</header>
<footer class="aui-nav" id="aui-footer">
    <div class="myBtn" tapmode onclick="openToTwo('release_win')" style="font-size: 16px;">发布商品</div>

</footer>

</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/jquery-1.11.3.js"></script>
<script type="text/javascript">
    apiready = function () {
        api.parseTapmode();
        var mobile = api.pageParam.mobile;
        var header = $api.dom('header');
        var footer = $api.dom('footer');
        $api.fixIos7Bar(header);
        
        var header_h = $api.offset(header).h;
        var footer_h = $api.offset(footer).h;
        var body_h = $api.offset($api.dom('body')).h - header_h - footer_h;
        api.openFrame({
            name: 'proManage_frm',
            url: 'proManage_frm.html',
            rect: {
                x: 0,
                y: header_h,
                w: 'auto',
                h: body_h
            },
            pageParam: {
                mobile: mobile
            },
            bounces: true,
            vScrollBarEnabled: false,
            hScrollBarEnabled: false
        });
        getStorageAll();
        //获取供应数量
        supplyManagementCount();
        //接收监听
        api.addEventListener({
            name: 'supplyCountUpdate'
        }, function (ret) {
            if (ret && ret.value) {
                supplyManagementCount();
            }
        });
    }
    //为了在下面的热门类别可以通用，单独出来
    function changeCheck(obj) {
        $(obj).parent().find("li").removeClass("active");
        $(obj).addClass("active");

        var status = $(obj).attr('data-id');
        //发送监听
        api.sendEvent({
            name: 'supplyStatus',
            extra: {
                status: status
            }
        });
    }

    //获取供应数量
    function supplyManagementCount() {
        // showLoading();
        data = {
            userName: user_name,
        };
        url = "User/supplyManagementCount";
        ajaxRequest(url, 'post', data, function (ret, err) {
            if (ret.status == 1) {
                $('#salesIn').text(ret.msg.salesIn);
                $('#shelfOff').text(ret.msg.shelfOff);
                $('#auditWait').text(ret.msg.auditWait);
            } else {
                api.toast({
                    msg: '数据错误',
                    duration: 2000,
                    location: 'bottom'
                });
            }
        });
        // hideLoading();
    }
</script>
</html>
